package com.rs.lc.pm.constans;

/**
 * Created by Xavier_Wei on 2016/11/15.
 */
public enum RoleEnum {

    ROLE_GUEST(1, "ROLE_GUEST"),
    ROLE_USER(2, "ROLE_USER"),
    ROLE_ADMIN(3, "ROLE_ADMIN");
    int index;
    String name;

    RoleEnum(int index, String name) {
        this.index = index;
        this.name = name;
    }

    public int getIndex() {
        return index;
    }

    public String getName() {
        return name;
    }

    public static RoleEnum getByName(String name) {
        for (RoleEnum e : RoleEnum.values()) {
            if (e.getName().equals(name)) return e;
        }
        return null;
    }
}
